<?php
class Controller_App_Verify extends Controller_App_Template
{
    
    public function __construct ($req, $res)
    {
        $this->template = "smarty:app/service/blank";
        parent::__construct($req, $res);
    }

    public function action_index ()
    {
        //
    }

    
    // 验证手机号
    public function action_mobile()
    {
        $post = $this->request->post();
        if (! empty($post))
        {
            $user = new User_V2_Guest();
            $mobile = $post['mobile'];
            $code = $post['code'];
            //验证验证码是否正确
            if (! $user->validMobileCode($mobile, $code))
            {
                $result = array('status' => 'false', 'msg' => '手机认证码失败');
            }else{
                $uid = $this->_uid;
                $result = App_Verify::bind_mobile($uid ,$mobile);
            }
            
            $this->template->set('result', $result);
        }
        $this->template->set_filename("smarty:app/verify/mobile");
    }

}
